import { DatePicker } from "element-ui";

// 时间选择器，editable默认值改为false
DatePicker.mixins[0].props.editable.default = false;

// 重写created方法，添加监听

const _created = DatePicker.created;
DatePicker.created = function () {
  _created.call(this);
  this.$on("focus", () => {
    this.$nextTick(() => {
      if (this.popperElm) {
        const inputList = this.popperElm.querySelectorAll(".el-input__inner");
        if (inputList?.length) {
          inputList.forEach((element) => {
            element.addEventListener("focus", () => {
              //监听 当input框获取焦点时,去掉input框获得的焦点,阻止输入法弹出
              document.activeElement.blur();
            });
          });
        }
      }
    })
  });
};
